package cn.edu.huanghuai.newsofhuanghuai.sevice.Impl;

import cn.edu.huanghuai.newsofhuanghuai.dao.NewsDao;
import cn.edu.huanghuai.newsofhuanghuai.dao.UserDao;
import cn.edu.huanghuai.newsofhuanghuai.pojo.News;
import cn.edu.huanghuai.newsofhuanghuai.pojo.User;
import cn.edu.huanghuai.newsofhuanghuai.sevice.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @user:whisper
* @date:6-11
* @description: 新闻实现类
 *
 *
*/

@Service
public class NewsServiceImpl implements NewsService {

    @Autowired
    private NewsDao newsDao;
    @Autowired
    private UserDao userDao;


    @Override
    public int addNews(News news)
    {
        return newsDao.addNews(news);
    }

    @Override
    public int deleteNews(int nid) {
        return newsDao.deleteNews(nid);
    }

    @Override
    public int updateNews(News news) {
        return newsDao.updateNews(news);
    }

    @Override
    public News queryNews(int nid) {
        return newsDao.queryNews(nid);
    }

    @Override
    public List<News> queryAllNews() {
        return newsDao.queryAllNews();
    }

    /**
     * 根据文章标题 进行模糊查询
     * @param title
     * @return
     */
    @Override
    public List<News> queryNewsByTitle(String title) {
        return newsDao.queryNewsByName(title);
    }


}
